/*************************************************************************
	> File Name: EP40.c
	> Author: 
	> Mail: 
	> Created Time: 
 ************************************************************************/
#include <stdio.h>
#include <math.h>

#define MAX_N 1000000

int get_digit(int n) {
    return floor(log10(n)) + 1;
}

int add(char *str, int n) {
    int cnt = 0, x = 0, k = 0;
    while (n) {
        x = x * 10 + n % 10;
        n /= 10;
        cnt++;
    }
    int digit = cnt;
    while (cnt--) {
        str[k++] = (x % 10 + '0');
        x /= 10;
    }
    str[k] = '\0';
    return digit;
}

int main() {
    char str[MAX_N * 6] = {0};
    int k = 1, count = 1, cnt = 0;
    str[0] = '0';
    while (k <= MAX_N) {
        k += add(str + k, count);
        count += 1;
    }
    int ans = 1, d = 1;
    for (int i = 0; i <= 6; i++) {
        ans *= (str[d] - '0');
        d *= 10;
    }
    printf("%d\n", ans);
    return 0;
}
